﻿using EM.OA.BLL;
using EM.OA.Common;
using EM.OA.DataModel.DBModel;
using EM.OA.WebCommon.Base;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel.DataAnnotations;
using System.EnterpriseServices;
using System.Linq;
using System.Reflection;
using System.Web;
namespace EM.OA.Portal.Models
{
    public class FixedAssetsModels : BaseViewModel
    {
        /// <summary>
        /// 固定资产ID
        /// </summary>		
        [Display(Name = "固定资产ID")]
        public Guid FixedAssetsID { get; set; }
        /// <summary>
        /// 固定资产编号
        /// </summary>		
        [Display(Name = "固定资产编号")]
        public string FixedAssetsCode { get; set; }
        /// <summary>
        /// 固定资产名称
        /// </summary>		
        [Display(Name = "固定资产名称")]
        public string FixedAssetsName { get; set; }
        /// <summary>
        /// 所属部门
        /// </summary>		
        [Display(Name = "所属部门")]
        public Guid DepartmentID { get; set; }
        /// <summary>
        /// 生产厂家
        /// </summary>		
        [Display(Name = "生产厂家")]
        public string Manufacturers { get; set; }
        /// <summary>
        /// 生产日期
        /// </summary>		
        [Display(Name = "生产日期")]
        public DateTime ProductionDateTime { get; set; }
        /// <summary>
        /// 购买日期
        /// </summary>		
        [Display(Name = "购买日期")]
        public DateTime PurchaseDateTime { get; set; }
        /// <summary>
        /// 启用时间
        /// </summary>		
        [Display(Name = "启用时间")]
        public DateTime EnableDateTime { get; set; }
        /// <summary>
        /// 原值
        /// </summary>		
        [Display(Name = "原值")]
        public int OriginalValue { get; set; }
        /// <summary>
        /// 残值
        /// </summary>		
        [Display(Name = "残值")]
        public int ScrapValue { get; set; }
        /// <summary>
        /// 折旧年限
        /// </summary>		
        [Display(Name = "折旧年限")]
        public int DepreciationLlife { get; set; }
        /// <summary>
        /// 累计折旧
        /// </summary>		
        [Display(Name = "累计折旧")]
        public int AccumulatedDepreciation { get; set; }
        /// <summary>
        /// 存放地点
        /// </summary>		
        [Display(Name = "存放地点")]
        public string Location { get; set; }
        /// <summary>
        /// 类别（字典）
        /// </summary>		
        [Display(Name = "类别")]
        public string DictionaryKind { get; set; }
        [Display(Name = "固定资产类型")]
        public string FixdAssetsKindName
        {
            get
            {
                return new DictionaryBLL().GetDicName(GlobalEnum.RootKind.FixedAssetsKind.ToString(), DictionaryKind);
            }
        }
        /// <summary>
        /// 是否有附件
        /// </summary>		
        [Display(Name = "是否有附件")]
        public bool HaveAttachment { get; set; }
        /// <summary>
        /// 状态
        /// </summary>		
        [Display(Name = "状态")]
        public byte Status { get; set; }
        public string StatusName
        {
            get
            {
                string Result = string.Empty;
                switch (Status)
                { 
                    case 0:
                        Result = "未使用";
                        break;
                    case 1:
                        Result = "使用中";
                        break;
                    case 2:
                        Result = "已提足折旧";
                        break;
                }
                return Result;
            }
        }

        /// <summary>
        /// 负责人
        /// </summary>		
        [Display(Name = "负责人")]
        public Guid ManageUserID { get; set; }
        public string ManageUserIDName
        {
            get
            {
                string result = "";
                if (ManageUserID.ToString().IsNotEmpty())
                {
                    string[] ids = ManageUserID.ToString().Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                    UserBLL bll = new UserBLL();
                    List<EMOA_User> entitys = bll.GetList(p => ids.Contains(p.UserID.ToString()));
                    entitys.ForEach(p =>
                    {
                        result += p.EmployeeName + ";";
                    });
                }
                return result;
            }
        }
        /// <summary>
        /// 备注
        /// </summary>		
        [Display(Name = "备注")]
        public string Remark { get; set; }

    }
}